import Vue from 'vue'
import Router from 'vue-router'
import index from '../components/index.vue'
import recommend from '../components/recommend.vue'
import hot from '../components/hot.vue'
import search from '../components/search.vue'
import play from '../components/play.vue'

Vue.use(Router)

export default new Router({
  routes: [
    // 重定向，将页面导航到另外一个地址
    { path: '/', redirect: '/recommend' },
    {
      path: '/',
      name: 'index',
      component: index,
      children: [
        {path: 'recommend',component: recommend},
        {path: 'hot',component: hot},
        {path: 'search',component: search}
      ]
    },
    {
      // 动态路由，id是变量，表明是那一首歌
      path: '/play/:id',
      component: play
    }
  ]
})
